<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>模块管理</title>
<link href="../../../static/css/style.css" rel="stylesheet" type="text/css" />
  <script type="text/javascript" src="../../../static/js/jquery.js"></script>
<script type="text/javascript" src="../../../static/laydate/laydate.js"></script>
</head>
<script type="text/javascript">
  $(function () {
    //父模块查询
    var modulePid = 0;
    $.ajax({
      type: "post",
      url: "/modules/moduleDetail2",
      data: {modulePid:modulePid},
      dataType: "JSON",
      success: function (rm) {
        var list = rm.data;
        var moduleStr = '<option value="">请选择</option>';
        for (let i = 0; i < list.length; i++) {
          moduleStr += '<option value="' + list[i].moduleId + '">' + list[i].moduleRname + '</option>\n';
        }
        $("#modulePid").html(moduleStr);
      },
      error: function (rm) {
        alert(rm.msg)
      }
    });

  })

  function moduleUpdateSave() {
    $.ajax({
      type: "post",
      url: "/modules/moduleAdd",
      data: $("#Form").serializeArray(),
      traditional: true,
      async: true,
      dataType: "JSON",
      success: function () {
        window.location.href = "list";
      },
      error: function (rm) {
        alert(rm.msg);
      }
    });
  }
</script>
<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li><a href="../modules/list">系统管理</a></li>
    <li><a href="../modules/list">模块管理</a></li>
    <li><a href="../modules/moduleAdd">添加</a></li>
  </ul>
</div>
<form id="Form">
<div class="formbody">
  <div class="formtitle"><span>模块信息</span></div>
  <ul class="forminfo">
    <li>
      <label>模块名称</label>
      <input name="moduleRname" id="moduleRname" type="text" class="dfinput"/>
      <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>父模块</label>
      <select name="modulePid" id="modulePid" class="dfselect">
        <option value="">请选择父模块</option>
        <option value="" selected="selected">系统管理</option>
        <option value="">营销管理</option>
        <option value="">采购管理</option>
      </select>
    </li>
    <li>
      <label>URL</label>
      <input name="moduleMurl" id="moduleMurl" type="text" class="dfinput"/>
      <i>必填，不能超过30个字符</i>
    </li>
    <li>
      <label>&nbsp;</label>
      <input name="" type="button" class="btn" onclick="moduleUpdateSave()" value="确认保存"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="button" class="btn" value="返回"  onclick="window.history.go(-1);"/>
    </li>
  </ul>
</div>
</form>
</body>
</html>
